/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package demo3791;

import eu.mpower.framework.management.patientmanagement.soap.GetPatientForPersonMessage;
import eu.mpower.framework.management.patientmanagement.soap.GetPatientsForUserMessage;
import eu.mpower.framework.management.patientmanagement.soap.GetPersonForUserMessage;
import eu.mpower.framework.management.patientmanagement.soap.GetProvidersForPatientMessage;
import eu.mpower.framework.management.patientmanagement.soap.GetRelationshipsForUserMessage;
import eu.mpower.framework.management.patientmanagement.soap.GetRelationshipsToUserMessage;
import eu.mpower.framework.management.patientmanagement.soap.Patient;
import eu.mpower.framework.management.patientmanagement.soap.PatientResponseMessage;
import eu.mpower.framework.management.patientmanagement.soap.PatientsResponseMessage;
import eu.mpower.framework.management.patientmanagement.soap.Person;
import eu.mpower.framework.management.patientmanagement.soap.PersonRelationship;
import eu.mpower.framework.management.patientmanagement.soap.PersonRelationshipsResponseMessage;
import eu.mpower.framework.management.patientmanagement.soap.PersonResponseMessage;
import eu.mpower.framework.management.patientmanagement.soap.Provider;
import eu.mpower.framework.management.patientmanagement.soap.ProviderType;
import eu.mpower.framework.management.patientmanagement.soap.ProvidersResponseMessage;
import eu.mpower.framework.security.types.soap.LoginStatus;
import eu.mpower.framework.security.types.soap.SecurityToken;
import eu.mpower.mpoweractivityservice.soap.AddActivityRequest;
import eu.mpower.mpoweractivityservice.soap.AddActivityResponse;
import eu.mpower.mpoweractivityservice.soap.Event;
import eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithAllRequest;
import eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithAllResponse;
import eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithGroupRequest;
import eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithGroupResponse;
import eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithIndividualResponse;
import java.util.GregorianCalendar;
import java.util.List;

/**
 *
 * @author stalew
 */
public class myFrame extends javax.swing.JFrame {

    long userID = 0;
    Patient selectedPatient = null;
    //Person selectedPerson = null;
    Provider selectedProvider = null;
    SecurityToken secToken = null;
    
    boolean adminUI = false;

    /**
     * Creates new form myFrame
     */
    public myFrame() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        userName = new javax.swing.JTextField();
        passWord = new javax.swing.JTextField();
        loginButton = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        logWindow = new javax.swing.JTextArea();
        activityName = new javax.swing.JTextField();
        activityDescription = new javax.swing.JTextField();
        addActivity = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        getActivities = new javax.swing.JButton();
        getCalendar = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();
        eventGroup = new javax.swing.JComboBox();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        userName.setText("username");

        passWord.setText("password");

        loginButton.setText("Login");
        loginButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                loginButtonActionPerformed(evt);
            }
        });

        logWindow.setColumns(20);
        logWindow.setRows(5);
        jScrollPane1.setViewportView(logWindow);

        activityName.setText("name");

        activityDescription.setText("description");

        addActivity.setText("Add Activity");
        addActivity.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                addActivityActionPerformed(evt);
            }
        });

        jLabel1.setText("Add your activity here");

        getActivities.setText("Get Activities");
        getActivities.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                getActivitiesActionPerformed(evt);
            }
        });

        getCalendar.setText("Load Calendar events");

        eventGroup.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "All -1", "Simons - 2", "Bjorgen - 3", "Johaug - 4", " " }));

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(50, 50, 50)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jSeparator1)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                                .add(userName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
                                .add(passWord))
                            .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 725, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(getActivities, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .add(getCalendar, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                            .add(loginButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
            .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
                .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(activityName)
                    .add(activityDescription)
                    .add(addActivity, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .add(jLabel1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 210, Short.MAX_VALUE)
                    .add(eventGroup, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .add(24, 24, 24))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(38, 38, 38)
                .add(userName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(passWord, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(loginButton))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(jSeparator1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .add(14, 14, 14)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 334, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(jLabel1)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(activityName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(activityDescription, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                    .add(layout.createSequentialGroup()
                        .add(getActivities)
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(getCalendar)))
                .add(18, 18, 18)
                .add(eventGroup, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 59, Short.MAX_VALUE)
                .add(addActivity)
                .add(26, 26, 26))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed
        // TODO add your handling code here:
        String user = userName.getText().trim();
        String pwd = passWord.getText().trim();



        LoginStatus ls = authenticateUserPass(user, pwd);

        if (ls.getStatus().getResult() == 0) {
            userID = new Long(ls.getSecurityToken().getUserID()).longValue();
            secToken = ls.getSecurityToken();
            logWindow.append("\nLogin ok:" + ls.getMessage() + " for user " + ls.getSecurityToken().getUserID());



            GetPersonForUserMessage gpfum = new GetPersonForUserMessage();
            gpfum.setSecurityToken(secToken);
            gpfum.setUserID(new Long(userID).longValue());

            PersonResponseMessage prm = getPersonForUser(gpfum);

            if (prm.getStatus().getResult() == 0) {
                logWindow.append("\nGetPersonForUser ok: " 
                        + prm.getPerson().getGivenNames() + " " 
                        + prm.getPerson().getFamilyName() + " logged in as " 
                        + gpfum.getSecurityToken().getPrimaryRoleName());

            }

            //if this is a provider - get patients
            String primRole = secToken.getPrimaryRoleName();
            if (primRole.equals("HealthProfessional") || primRole.equals("Appointed GP"))  {
                //set the UI to be admin
                adminUI=true;
                
                selectedProvider = new Provider();
                selectedProvider.setPerson(prm.getPerson());
                ProviderType pt = new ProviderType(); //cannot really find more information about the provider...
                selectedProvider.setProviderType(pt);
                 
                GetPatientsForUserMessage patM = new GetPatientsForUserMessage();
                patM.setSecurityToken(secToken);
                patM.setUserID(new Long(userID).longValue());

                PatientsResponseMessage patRes = getPatientsForUser(patM);

                if (patRes.getStatus().getResult() == 0) {

                    List<Patient> patList = patRes.getPatients();

                    for (Patient p : patList) {
                        selectedPatient = p;
                        logWindow.append("\nPatient found \n" 
                                + p.getPerson().getFamilyName() + " " 
                                + p.getPerson().getGivenNames() + " (" 
                                + p.getId() + ")");

                    }

                }
            }//end if provider
            else {
                //we have a patient. 
                adminUI=false;
                
                //Get patient object
                GetPatientForPersonMessage perM = new GetPatientForPersonMessage();
                perM.setSecurityToken(secToken);
                perM.setPersonID(prm.getPerson().getId());
                
                PatientResponseMessage patM = getPatientForPerson(perM);
                
                if (patM.getStatus().getResult()==0) {
                    selectedPatient = patM.getPatient();
                    logWindow.append("\nFound patient: " + selectedPatient.getId() + " - " + selectedPatient.getPerson().getGivenNames());
                    
                }
                
                //get the providers
                GetProvidersForPatientMessage provM = new GetProvidersForPatientMessage();
                provM.setSecurityToken(secToken);
                provM.setPatientID(selectedPatient.getId());
                
                ProvidersResponseMessage provRes = getProvidersForPatient(provM);
                if (provRes.getStatus().getResult()==0) {
                    logWindow.append("\nFound providers: " + provRes.getProviders().size());
                    List<Provider> provList = provRes.getProviders();
                    for (Provider prov : provList) {
                        logWindow.append("\nProvider " + prov.getId() + " - " 
                                + prov.getPerson().getGivenNames()   + " " 
                                + prov.getPerson().getFamilyName()   + " (" 
                                + prov.getProviderType().getProviderTypeName() + ")");
                        
                    
                    }
                            
                
                }
                
                //get other relationships
                GetRelationshipsForUserMessage relM = new GetRelationshipsForUserMessage();
                relM.setSecurityToken(secToken);
                relM.setUserID(userID); //assuming this is the patient's userID
                
                PersonRelationshipsResponseMessage relRes = getRelationshipsForUser(relM);
                
                if (relRes.getStatus().getResult()==0) {
                    //print the relationships
                    List<PersonRelationship> rList = relRes.getRelationships();
                    
                    for (PersonRelationship pr: rList) {
                    
                        logWindow.append("\n: Found Relationship from: " + pr.getFromPerson().getFamilyName() 
                                + " to " + pr.getToPerson().getFamilyName() + " as " 
                                + pr.getRelationshipType().getRelationshipTypeName() );
                        
                    }
                
                }
                
                //get other relationships
                GetRelationshipsToUserMessage relTM = new GetRelationshipsToUserMessage();
                relTM.setSecurityToken(secToken);
                relTM.setUserID(userID); //assuming this is the patient's userID
                
                PersonRelationshipsResponseMessage relTRes = getRelationshipsToUser(relTM);
                
                if (relTRes.getStatus().getResult()==0) {
                    //print the relationships
                    List<PersonRelationship> rTList = relTRes.getRelationships();
                    
                    for (PersonRelationship pr: rTList) {
                    
                        logWindow.append("\n: Found Relationship TO: " + pr.getFromPerson().getFamilyName() 
                                + " FROM " + pr.getToPerson().getFamilyName() + " as " 
                                + pr.getRelationshipType().getRelationshipTypeName() );
                        
                    }
                
                }
                
            }
           
        }

   
    }//GEN-LAST:event_loginButtonActionPerformed
    private void getActivitiesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_getActivitiesActionPerformed
        // TODO add your handling code here:
        //GetActivitiesForUserByDateWithAllResponse getActivitiesForUserByDateWithAll(eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithAllRequest 
        GetActivitiesForUserByDateWithGroupRequest getA = new GetActivitiesForUserByDateWithGroupRequest();
        getA.setSecurityToken(secToken);
        if (adminUI) {
            getA.setPersonId(selectedProvider.getPerson().getId());
        }
        else {
            getA.setPersonId(selectedPatient.getPerson().getId());
        }
            
        
        GetActivitiesForUserByDateWithGroupResponse actRes = getActivitiesForUserByDateWithGroup(getA);
        
        if (actRes.getStatus().getResult()==0) {
            logWindow.append("\nWe found " + actRes.getEvents().size() + " activities for this user" ); 
            List<Event> evList = actRes.getEvents();
            for (Event e: evList) {
                logWindow.append("\nActivity: " + e.getName() + " - "
                        + e.getDescription() + " at "
                        + e.getStartDate());
            }
        
        }
        
        else {
            logWindow.append("\nNo activities found");
        }
    }//GEN-LAST:event_getActivitiesActionPerformed

    private void addActivityActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addActivityActionPerformed
        // TODO add your handling code here:
        //AddActivityResponse addActivity(eu.mpower.mpoweractivityservice.soap.AddActivityRequest
        AddActivityRequest aReq = new AddActivityRequest();
        aReq.setSecurityToken(secToken);
        
        
        Event ev = new Event();
        //THESE THREE MUST BE SET TO 1.
        ev.setActivityID(1); 
        ev.setLocationID(1);  
        
        //group must be fetched from GUI combo
        ev.setGroupID(eventGroup.getSelectedIndex()+1); //hard coded order.. 
      
    
        
        ev.setName(activityName.getText().trim());
        ev.setDescription(activityDescription.getText().trim());
        ev.setDuration(200000);
        ev.setCost(0);
        ev.setPersonID(selectedPatient.getPerson().getId());
        ev.setLink("http://www.vg.no");
        ev.setMaxParticipants(200);
        ev.setStartDate(new GregorianCalendar().getTimeInMillis());
        ev.setEndDate(ev.getStartDate() + 1000000);
        
        aReq.setEvent(ev);
       
        
        AddActivityResponse aRes = addActivity(aReq);
        logWindow.append("\nResult id=: " 
                + aRes.getId() + " " 
                + aRes.getStatus().getErrorCause() + "-XACML: " 
                + aRes.getStatus().getResultPolicies().toString());
        
        
       
    }//GEN-LAST:event_addActivityActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                

}
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(myFrame.class  

.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } 

catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(myFrame.class  

.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } 

catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(myFrame.class  

.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } 

catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(myFrame.class  

.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new myFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField activityDescription;
    private javax.swing.JTextField activityName;
    private javax.swing.JButton addActivity;
    private javax.swing.JComboBox eventGroup;
    private javax.swing.JButton getActivities;
    private javax.swing.JButton getCalendar;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JTextArea logWindow;
    private javax.swing.JButton loginButton;
    private javax.swing.JTextField passWord;
    private javax.swing.JTextField userName;
    // End of variables declaration//GEN-END:variables

    private static LoginStatus authenticateUserPass(java.lang.String username, java.lang.String password) {
        eu.mpower.framework.security.authentication.soap.AuthenticationWServiceService service = new eu.mpower.framework.security.authentication.soap.AuthenticationWServiceService();
        eu.mpower.framework.security.authentication.soap.PortTypeAuthenticationWService port = service.getAuthenticationWServicePort();
        return port.authenticateUserPass(username, password);
    }

    private static PersonResponseMessage getPersonForUser(eu.mpower.framework.management.patientmanagement.soap.GetPersonForUserMessage userIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getPersonForUser(userIDmsg);
    }

    private static PatientsResponseMessage getPatientsForUser(eu.mpower.framework.management.patientmanagement.soap.GetPatientsForUserMessage userIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getPatientsForUser(userIDmsg);
    }

    private static PatientResponseMessage getPatientDetails(eu.mpower.framework.management.patientmanagement.soap.GetPatientDetailsMessage patientid) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getPatientDetails(patientid);
    }

    private static PatientResponseMessage getPatientForPerson(eu.mpower.framework.management.patientmanagement.soap.GetPatientForPersonMessage personIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getPatientForPerson(personIDmsg);
    }

    private static ProvidersResponseMessage getProvidersForPatient(eu.mpower.framework.management.patientmanagement.soap.GetProvidersForPatientMessage patientIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getProvidersForPatient(patientIDmsg);
    }

    private static PersonRelationshipsResponseMessage getRelationshipsForUser(eu.mpower.framework.management.patientmanagement.soap.GetRelationshipsForUserMessage userIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getRelationshipsForUser(userIDmsg);
    }

    private static PersonRelationshipsResponseMessage getRelationshipsToUser(eu.mpower.framework.management.patientmanagement.soap.GetRelationshipsToUserMessage userIDmsg) {
        eu.mpower.framework.management.patientmanagement.soap.PatientManagement service = new eu.mpower.framework.management.patientmanagement.soap.PatientManagement();
        eu.mpower.framework.management.patientmanagement.soap.IPatientManagement port = service.getIPatientManagement();
        return port.getRelationshipsToUser(userIDmsg);
    }

    private static GetActivitiesForUserByDateWithAllResponse getActivitiesForUserByDateWithAll(eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithAllRequest parameters) {
        eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service service = new eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service();
        eu.mpower.mpoweractivityservice.soap.ActivityWebService port = service.getActivityWebServicePort();
        return port.getActivitiesForUserByDateWithAll(parameters);
    }

    private static AddActivityResponse addActivity(eu.mpower.mpoweractivityservice.soap.AddActivityRequest parameters) {
        eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service service = new eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service();
        eu.mpower.mpoweractivityservice.soap.ActivityWebService port = service.getActivityWebServicePort();
        return port.addActivity(parameters);
    }

    private static GetActivitiesForUserByDateWithIndividualResponse getActivitiesForUserByDateWithIndividual(eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithIndividualRequest parameters) {
        eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service service = new eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service();
        eu.mpower.mpoweractivityservice.soap.ActivityWebService port = service.getActivityWebServicePort();
        return port.getActivitiesForUserByDateWithIndividual(parameters);
    }

    private static GetActivitiesForUserByDateWithGroupResponse getActivitiesForUserByDateWithGroup(eu.mpower.mpoweractivityservice.soap.GetActivitiesForUserByDateWithGroupRequest parameters) {
        eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service service = new eu.mpower.mpoweractivityservice.soap.ActivityWebService_Service();
        eu.mpower.mpoweractivityservice.soap.ActivityWebService port = service.getActivityWebServicePort();
        return port.getActivitiesForUserByDateWithGroup(parameters);
    }
}
